var React = require("react");

var MyButton = function(props) {
    var items = props.items;
    var itemHtml = items.map(function(listitem, i) {
        return <li key={i}>{listitem}</li>;
    });
    return <div>
        <ul>{itemHtml}</ul>
        <button onClick={props.onClick}>Create Item</button>
    </div>;

    //return <div>
    //    <button onClick={props.onClick}>New Item</button>
    //</div>;
};

module.exports = MyButton;

// 无状态组件定义方式
